- purchase_link = plan.purchase_link
- plan_name = plan.name
- show_deprecated_plan = ::Feature.enabled?(:hide_deprecated_billing_plans) && plan.deprecated?
- has_upgrade = has_upgrade?(plan_offer_type)
- if show_deprecated_plan
  - plan_name      += ' (Legacy)'
  - faq_link_url   = "https://#{ApplicationHelper.promo_host}/pricing/faq-new-product-subscription-tiers"
  - faq_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: faq_link_url }

.card-wrapper{ class: ("card-wrapper-has-badge" if has_upgrade), data: { testid: "plan-card-#{plan.code}" } }
  - if has_upgrade
    .card-badge
      %span.card-badge-text
        - case plan_offer_type
        - when :upgrade_for_free
          = s_("BillingPlans|Free upgrade!")
        - else
          = _("Upgrade offers available!")
  .card{ class: ("card-active" if is_current || show_deprecated_plan) }
    .card-header.gl-line-height-normal.gl-py-5.gl-font-weight-bold
      = plan_name

    .card-body
      - if show_deprecated_plan
        = s_("The %{plan_name} is no longer available to purchase. For more information about how this will impact you, check our %{faq_link_start}frequently asked questions%{faq_link_end}.").html_safe % { plan_name: plan.name, faq_link_start: faq_link_start, faq_link_end: '</a>'.html_safe }
      - else
        .price-description
          .gl-mr-2.gl-display-flex.gl-align-items-center
            - case plan_offer_type
            - when :upgrade_for_free
              %span.gl-mr-3.price-rebate
                = number_to_plan_currency(plan.price_per_month)
              %span
                = number_to_plan_currency(plan.upgrade_price_per_month)
            - when :upgrade_for_offer
              %span.price-cut
                = number_to_plan_currency(plan.price_per_month)
            - else
              %span
                = number_to_plan_currency(plan.price_per_month)

          %ul.conditions.gl-p-0.gl-my-auto
            %li= s_("BillingPlans|per user")
            %li= s_("BillingPlans|monthly")
        .price-conclusion{ class: ("invisible" unless plan.price_per_year > 0) }
          - case plan_offer_type
          - when :upgrade_for_free
            = s_("BillingPlans|for the remainder of your subscription")
          - else
            - price_per_year = number_to_plan_currency(plan.price_per_year)
            = s_("BillingPlans|billed annually at %{price_per_year}") % { price_per_year: price_per_year }
        %hr.gl-my-3

        %ul.unstyled-list
          - plan_feature_list(plan).each do |feature|
            - feature_class = "gl-p-0!"
            - if feature.highlight
              - feature_class += " gl-font-weight-bold"
            %li{ class: "#{feature_class}" }
              = feature.title
          %li.gl-p-0.gl-pt-3
            - if plan.about_page_href
              = link_to s_("BillingPlans|See all %{plan_name} features") % { plan_name: plan.name },
                subscriptions_comparison_url,
                data: { track_action: 'click_link',
                        track_label: 'plan_features',
                        track_property: plan.code }

    - unless read_only
      .card-footer
        - show_upgrade_button = show_upgrade_button?(purchase_link.action, plan_offer_type, plan.allow_upgrade)
        .gl-min-h-7.gl-display-flex.gl-flex-wrap.gl-justify-content-end
          = render "shared/billings/billing_plan_actions", namespace: namespace, plan: plan,
                                                           purchase_link: purchase_link, show_upgrade_button: show_upgrade_button,
                                                           plan_offer_type: plan_offer_type, is_current: is_current
